var t = getApp();

Page({
    data: {
        active2: !0,
        active: 9999,
        list: [],
        shop_id: "",
        contentlist: {},
        state: {
            adv_img: "",
            adv_url: ""
        },
        formCard: ""
    },
    onLoad: function(t) {
        t.shop_id && this.setData({
            shop_id: t.shop_id
        }), t.formCard && this.setData({
            formCard: t.formCard
        }), this.getList(), this.getContentlist2();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getList: function() {
        var a = this, e = t.getNetAddresss("goods.category.get-category");
        e += "&shop_id=" + a.data.shop_id, t._getNetWork({
            url: e,
            success: function(t) {
                var e = t.data;
                1 == e.result && a.setData({
                    list: e.data.data
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getContentlist2: function() {
        var a = this, e = t.getNetAddresss("shop.index.get-default-index");
        e += "&shop_id=" + a.data.shop_id, t._getNetWork({
            url: e,
            success: function(t) {
                var e = t.data;
                1 == e.result ? (a.setData({
                    "contentlist.category": e.data.category,
                    err: !1
                }), a.setData({
                    "contentlist.goo": !0,
                    "contentlist.tjfl": !0,
                    "contentlist.set": e.data.set
                })) : a.setData({
                    err: !0
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    tabsa: function(t) {
        var a = t.currentTarget.dataset.index, e = t.currentTarget.dataset.item;
        this.tabsaData(a, e);
    },
    tabsaData: function(t, a) {
        this.setData({
            "state.adv_img": a.adv_img,
            "state.adv_url": a.adv_url
        }), this.setData({
            active: t,
            active2: !1
        }), this.getContentlist(a.id);
    },
    getContentlist: function(a) {
        var e = this, s = t.getNetAddresss("goods.category.get-children-category");
        s += "&parent_id=" + a, s += "&shop_id=" + e.data.shop_id, t._getNetWork({
            url: s,
            success: function(t) {
                var a = t.data;
                1 == a.result ? (e.setData({
                    err: !1,
                    contentlist: a.data
                }), e.setData({
                    "contentlist.tjfl": !1,
                    "contentlist.set": a.data.set
                })) : e.setData({
                    err: !0
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    allList: function() {
        this.setData({
            active2: !0,
            active: 9999
        }), this.getContentlist2();
    }
});